home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr18 / mrun210.zip / NEWFILES.WAS < prev    next >
Text File  |  1993-04-28  |  5KB  |  181 lines

  1. ;New file scan script for MailRun 2.1 
  2.  
  3.  
  4. ;Note that this script uses the value of TaskItem (the currently selected
  5. ;line in the Task List) to determine the current BBS.  It will therefore
  6. ;not function properly when the user manually changes the selected item
  7. ;just prior to execution of this script.
  8.  
  9.  
  10. #define TempDir s6
  11. #define MailRunIni s7
  12. #define MailRun s8
  13. #define TaskItem s9
  14. #define IdleTimer i0
  15. #define AnsiInLog i5
  16. #define LogRun i7
  17.  
  18. string prompt, BBS, BBSType
  19. integer holdstatus 
  20.  
  21. proc main
  22. string char, BBS_X, BBSLst, CapFile, TmpCap, MailRunDir
  23. integer i
  24.     ;find last default capture file
  25.     fetch capture file CapFile
  26.     ;change the default capture file
  27.     capture OFF
  28.     set capture file "_tmp.cap"
  29.     set capture mode create VISUAL
  30.     capture ON
  31.     
  32.     ;find current BBS, BBSType, etc.
  33.     strextract char TaskItem "`t" 3
  34.     atoi char i
  35.     strfmt BBS_X "BBS_%d" i
  36.     profilerd MailRun "MailRun" BBS_X BBS
  37.     profilerd MailRun BBS "BBSType" BBSType
  38.     profilerd MailRunIni "MailRun" "MailRunDir" MailRunDir
  39.     if !(findstring(BBSType, "PCBoard"))
  40.         when quiet 1 call checkfileprompt
  41.         holding()
  42.         clearwhen quiet
  43.     endif
  44.     if findstring(BBSType, "Auntie")
  45.         transmit "LN;;^M"
  46.     elseif findstring(BBSType, "PCBoard")
  47.         transmit "N;U^M"
  48.     elseif findstring(BBSType, "WildCat")
  49.         transmit "N^M"
  50.     elseif findstring(BBSType, "RBBS")
  51.         transmit "N;S;A^M"
  52.     endif
  53.     when quiet 1 call checkprompt
  54.     holding()
  55.     clearwhen quiet
  56.     capture OFF
  57.     if !(findstring(BBSType, "PCBoard"))
  58.         when quiet 1 call checkmainprompt
  59.         holding()
  60.         clearwhen quiet
  61.     endif
  62.     BBSLst = makefullname(MailRunDir, BBS)
  63.     strcat BBSLst ".lst"
  64.     TmpCap = makefullname(MailRunDir, "_tmp.cap")
  65.     copyfile TmpCap BBSLst
  66.     delfile TmpCap
  67.     set capture file CapFile
  68.     if LogRun
  69.         if AnsiInLog
  70.             set capture mode append RAW
  71.         else
  72.             set capture mode append VISUAL
  73.         endif
  74.         capture ON
  75.     endif
  76. endproc
  77.  
  78. proc checkprompt
  79. string CommandPrompt, FilePrompt, MorePrompt, ContinuePrompt
  80.     profilerd MailRun BBS "CommandPrompt" CommandPrompt
  81.     profilerd MailRun BBS "FilePrompt" FilePrompt
  82.     profilerd MailRun BBS "MorePrompt" MorePrompt
  83.     profilerd MailRun BBS "ContinuePrompt" ContinuePrompt
  84.     if findstring(prompt, CommandPrompt) || findstring(prompt, FilePrompt)
  85.         endhold()
  86.     elseif findstring(BBSType, "Auntie") && findstring(prompt, "More (")
  87.         transmit "NS^M"
  88.     elseif findstring(prompt, MorePrompt)
  89.         transmit "NS^M"
  90.     elseif findstring(BBSType, "Auntie") && findstring(prompt, ContinuePrompt)        
  91.         transmit "^M"
  92.     elseif findstring(prompt, ContinuePrompt) 
  93.         transmit "y^M"
  94.     elseif findstring(BBSType, "WildCat") && findstring(prompt, "[L]ast new")
  95.         transmit "L^M"
  96.     elseif (findstring(BBSType, "PCBoard") && \
  97.         findstring(prompt, "(Enter)=?")) || (findstring(BBSType, "WildCat") && \
  98.         findstring(prompt, "ENTER = All"))
  99.         transmit "^M"
  100.     endif
  101. endproc
  102.  
  103. proc checkfileprompt
  104. string FilePrompt, CommandPrompt
  105.     profilerd MailRun BBS "FilePrompt" FilePrompt
  106.     profilerd MailRun BBS "CommandPrompt" CommandPrompt
  107.     if findstring(prompt, CommandPrompt)
  108.         transmit "f^M"
  109.     elseif findstring(prompt, FilePrompt)
  110.         endhold()
  111.     endif
  112. endproc
  113.  
  114. proc checkmainprompt
  115. string FilePrompt, CommandPrompt
  116.     profilerd MailRun BBS "FilePrompt" FilePrompt
  117.     profilerd MailRun BBS "CommandPrompt" CommandPrompt
  118.     if findstring(prompt, FilePrompt)
  119.         if !(findstring(BBSType, "RBBS"))
  120.             transmit "q^M"
  121.         else
  122.             transmit "q;m^M"
  123.         endif
  124.     elseif findstring(prompt, CommandPrompt)
  125.         endhold()
  126.     endif
  127. endproc
  128.  
  129. proc holding
  130. string LastPrompt
  131. integer IdleTimeout
  132.     profilerd MailRun "MailRun" "IdleTimeout" IdleTimeout
  133.     IdleTimer = 1
  134.     holdstatus = 1
  135.     prompt = ""
  136.     while (IdleTimer < IdleTimeout) && (holdstatus == 1) && $CARRIER
  137.         pause 1
  138.         termgets $ROW 0 prompt $COL
  139.         if not strcmp prompt LastPrompt
  140.             ;if anything has been received, reset the timer
  141.             IdleTimer = 1
  142.         endif
  143.         LastPrompt = prompt
  144.         IdleTimer++
  145.     endwhile
  146.     if (IdleTimer == IdleTimeout) || ($CARRIER == 0)
  147.         ;If there has been a timeout, lost carrier or user escape...
  148.         clearwhen quiet
  149.         ;set FailCode and get out
  150.         if IdleTimer == IdleTimeout
  151.             capturestr "`r`n`r`n***** Timed out waiting for prompt *****`r`n`r`n"
  152.         else
  153.             capturestr "`r`n`r`n************* Lost carrier *************`r`n`r`n"
  154.         endif
  155.     endif
  156. endproc
  157.  
  158. proc endhold
  159.     holdstatus = 0
  160. endproc
  161.  
  162. func findstring : integer
  163. strparm String1, String2
  164. integer i = 0
  165.     if not NULLSTR String2
  166.         if strfind String1 String2
  167.             i = 1
  168.         endif
  169.     endif
  170.     return i
  171. endfunc
  172.  
  173. func makefullname : string
  174. strparm Directory, FileNamen
  175. string FullName
  176.     FullName = Directory
  177.     addfilename FullName FileNamen
  178.     return FullName
  179. endfunc
  180.  
  181.